const mongoose = require('mongoose')
const md5 = require('../utils/md5')

const messageSchema = new mongoose.Schema({
    // 发送用户
    sendUser: {
        type: String,
        required: true
    },
    // 接受用户
    receptionUser: {
        type: String,
        required: true
    },
    // 消息状态 0: 未读 1: 已读 3: 已处理
    status: {
        type: String,
        required: true
    },
    // 消息创建时间
    createdAt: {
        type: Date,
        default: Date.now
    },
    // 消息内容
    content: {
        type: String,
        required: true
    },
    // 消息类型 0：添加好友请求 1:接收好友请求 2:拒绝好友请求 3：表格共享 
    type: {
        type: String,
        required: true
    },
    sendUserMessage: {
        type: Object,
        required: true
    },
    receptionUserMessage: {
        type: Object,
        required: true
    },
    sheetId: {
        type: String,
        required: false
    }
})

module.exports = messageSchema